<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
	xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
	<xsl:output method="xml" indent="yes"></xsl:output>
	
	
	
	
	<!--
	<xsl:namespace-alias result-prefix="xmi" stylesheet-prefix="xmi"/> 
	<packagedElement xmi:type="uml:Component" xmi:id="_MSRf4E1kEd-ayfJs67XReA"
				name="index.html" />
			<packagedElement xmi:type="uml:Component" xmi:id="index1.html"
				name="index1.html" clientDependency="_lt7WsE1rEd-ayfJs67XReA" />
			<packagedElement xmi:type="uml:Component" xmi:id="index2.html"
				name="index2.html" clientDependency="_-WHKME1nEd-ayfJs67XReA" />
			<packagedElement xmi:type="uml:Component" xmi:id="3"
				name="index3.html" clientDependency="_-WHKME1nEd-ayfJs67XReA _-WHKME1nEd-ayfJs67XReA" />
			<packagedElement xmi:type="uml:Component" xmi:id="4"
				name="index4.html" />
			<packagedElement xmi:type="uml:Dependency" xmi:id="9"
				name="my dependensy" supplier="4" client="3" />
 	-->				
			
	<xsl:template match="/">
	
		<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
			xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_KO6hAU1kEd-ayfJs67XReA"
			name="component">
			<elementImport xmi:id="_KSh1sE1kEd-ayfJs67XReA">
				<importedElement xmi:type="uml:PrimitiveType"
					href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolean" />
			</elementImport>
			<elementImport xmi:id="_KSuqAE1kEd-ayfJs67XReA">
				<importedElement xmi:type="uml:PrimitiveType"
					href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String" />
			</elementImport>
			<elementImport xmi:id="_KSuqAU1kEd-ayfJs67XReA">
				<importedElement xmi:type="uml:PrimitiveType"
					href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#UnlimitedNatural" />
			</elementImport>
			<elementImport xmi:id="_KSvREE1kEd-ayfJs67XReA">
				<importedElement xmi:type="uml:PrimitiveType"
					href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer" />
			</elementImport>
			
			<xsl:apply-templates />
			<xsl:apply-templates mode="Dependency" />
		</uml:Model>
	</xsl:template>

	<!-- 
	<xsl:template match="//dir/file[@ext='xsl']" mode="Dependency">
	 -->
	<xsl:template match="//dir/file" mode="Dependency">	 
		<xsl:variable name="fileId" select="@id"/>
		<xsl:for-each select=".//link">
		<packagedElement xmi:type="uml:Dependency">
				<xsl:attribute name="xmi:id"><xsl:value-of select="@id"/></xsl:attribute>
				<xsl:attribute name="supplier"><xsl:value-of select="@fileId"/></xsl:attribute>
				<xsl:attribute name="client"><xsl:value-of select="$fileId"/></xsl:attribute>
		</packagedElement>
		</xsl:for-each>
	</xsl:template>

	<!-- 
	<xsl:template match="//file[@ext='xsl']">
	 -->
	<xsl:template match="//file">	 
			<packagedElement xmi:type="uml:Component">
 				<xsl:attribute name="xmi:id"><xsl:value-of select="@id"/></xsl:attribute>
				<xsl:attribute name="name"><xsl:value-of select="@fullName"/></xsl:attribute>			
			</packagedElement>
	</xsl:template>
	


</xsl:stylesheet>